﻿Imports System
Imports System.Windows.Forms
Imports System.Data


Public Class FrmNgay

    Private _Ngay As Date?
    Public Property Ngay() As Date?
        Get
            Return _Ngay
        End Get
        Set(ByVal value As Date?)
            _Ngay = value
        End Set
    End Property

    Private Sub FrmNgay_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If (e.Modifiers = GetKeyModifide("EXIT") And _
     e.KeyCode = GetKeyCode2("EXIT")) Or _
     (e.KeyCode = GetKeyCode("EXIT")) Then
            btnHuyBo_Click(Nothing, Nothing)
        End If

        If (e.Modifiers = GetKeyModifide("ACCEPT") And _
     e.KeyCode = GetKeyCode2("ACCEPT")) Or _
     (e.KeyCode = GetKeyCode("ACCEPT")) Then

            If btnChapNhan.Enabled = True And btnChapNhan.Visible = True Then
                btnChapNhan_Click(Nothing, Nothing)
            End If
        End If
    End Sub

    Private Sub FrmThangNamBaoCao_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'btnChapNhan.Image = Global.Publics.My.Resources.ResourceManager.GetObject("ok")
        'btnHuyBo.Image = Global.Publics.My.Resources.ResourceManager.GetObject("cancel")
        'spinNam.Text = Year(dbVms.GetDateTimeServer)
        dteNgay.DateTime = dbTV.GetDateTimeServer
        btnChapNhan.Text = BtnAcceptCaption
        btnHuyBo.Text = BtnCancelCaption
        dteNgay.Focus()
         
        Me.KeyPreview = True
    End Sub

    Private Sub btnHuyBo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnHuyBo.Click
        Me.Close()
    End Sub

    Private Sub spinNam_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
        If e.KeyCode = Keys.Enter Then
            btnChapNhan.Select()
        End If
    End Sub

    Private Sub btnChapNhan_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnChapNhan.Click
        Ngay = dteNgay.DateTime
        Me.Close()
    End Sub

End Class